package com.example.s05_shop;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
// 扫描mapper
@MapperScan("com.example.s05_shop.mapper")
// 支持Servlet的方式1: 添加注解，扫描Servlet
//@ServletComponentScan
public class S05ShopApplication {

    public static void main(String[] args) {
        SpringApplication.run(S05ShopApplication.class, args);
    }



    // @Bean
    // SpringBoot 会扫描到这个方法  调用该方法 放到Spring容器中



    // 最新版
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

}


